<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Comment extends Model
{

    protected $fillable = ['user_id','content']; //可以注入的数据字段
    //评论所属文章
    public function post(){
        return $this->belongsTo(Post::class,'post_id','id');
    }

    //评论所属对象
    public function user(){
        return $this->belongsTo(User::class,'user_id','id');
    }
}